package cn.jiahua.test12;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class Test {
    public static void main(String[] args) {
            MyThread myThread =new MyThread();
            FutureTask futureTask =new FutureTask(myThread);

            new Thread(futureTask).start();
        try {
            Integer o = (Integer) futureTask.get();
            System.out.println(o);
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        }
    }
}

class MyThread implements Callable<Integer>{

    public Integer call(){

        System.out.println("call");
        return 1024;
    }
}